package com.wyzz.hr.pojo.base;

import java.io.Serializable;
import java.util.Set;
import java.util.TreeSet;
import org.apache.axis.utils.StringUtils;

import com.wyzz.hr.pojo.Empsalaryacct;
import com.wyzz.hr.pojo.Empsalaryacctitems;
import com.wyzz.hr.pojo.Empsalaryacctversion;

public abstract class BaseEmpsalaryacct implements Serializable {

	public BaseEmpsalaryacct() {
		hashCode = 0x80000000;
		initialize();
	}

	public BaseEmpsalaryacct(String id) {
		hashCode = 0x80000000;
		setId(id);
		initialize();
	}

	public BaseEmpsalaryacct(String id, String esacName) {
		hashCode = 0x80000000;
		setId(id);
		setEsacName(esacName);
		initialize();
	}

	protected void initialize() {
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
		hashCode = 0x80000000;
	}

	public String getEsacName() {
		return esacName;
	}

	public void setEsacName(String esacName) {
		this.esacName = esacName;
	}

	public String getEsacDesc() {
		return esacDesc;
	}

	public void setEsacDesc(String esacDesc) {
		this.esacDesc = esacDesc;
	}

	public Set getEmpsalaryacctitems() {
		return empsalaryacctitems;
	}

	public void setEmpsalaryacctitems(Set empsalaryacctitems) {
		this.empsalaryacctitems = empsalaryacctitems;
	}

	public void addToempsalaryacctitems(Empsalaryacctitems empsalaryacctitems) {
		if (null == getEmpsalaryacctitems())
			setEmpsalaryacctitems(new TreeSet());
		getEmpsalaryacctitems().add(empsalaryacctitems);
	}

	public Set getEmpsalaryacctversion() {
		return empsalaryacctversion;
	}

	public void setEmpsalaryacctversion(Set empsalaryacctversion) {
		this.empsalaryacctversion = empsalaryacctversion;
	}

	public void addToempsalaryacctversion(
			Empsalaryacctversion empsalaryacctversion) {
		if (null == getEmpsalaryacctversion())
			setEmpsalaryacctversion(new TreeSet());
		getEmpsalaryacctversion().add(empsalaryacctversion);
	}

	public boolean equals(Object obj) {
		if (null == obj)
			return false;
		if (obj instanceof Empsalaryacct) {
			Empsalaryacct empsalaryacct = (Empsalaryacct) obj;
			if (null == getId() || null == empsalaryacct.getId())
				return false;
			else
				return getId().equals(empsalaryacct.getId());
		}
		if (obj instanceof Empsalaryacctitems) {
			Empsalaryacctitems items = (Empsalaryacctitems) obj;
			if (items == null
					|| items.getEsaiEsav() == null
					|| items.getEsaiEsav().getEsavEsac() == null
					|| StringUtils.isEmpty(items.getEsaiEsav().getEsavEsac()
							.getEsacName()))
				return false;
			if (items.getEsaiEsav().getEsavEsac().getEsacName().trim().equals(
					getEsacName()))
				return true;
		}
		return false;
	}

	public int hashCode() {
		if (0x80000000 == hashCode) {
			if (null == getId())
				return super.hashCode();
			String hashStr = (new StringBuilder()).append(getClass().getName())
					.append(":").append(getId().hashCode()).toString();
			hashCode = hashStr.hashCode();
		}
		return hashCode;
	}

	public String toString() {
		return super.toString();
	}

	public static String REF = "Empsalaryacct";
	public static String PROP_ESAC_DESC = "esacDesc";
	public static String PROP_ESAC_NAME = "esacName";
	public static String PROP_ID = "id";
	private int hashCode;
	private String id;
	private String esacName;
	private String esacDesc;
	private Set empsalaryacctitems;
	private Set empsalaryacctversion;

}
